﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RevitAddin
{
    public partial class APIForm : Form
    {
        public APIForm()
        {
            InitializeComponent();
        }

        private void APIForm_Load(object sender, EventArgs e)
        {
            string url = comMethod.ReadAPIPath();
            textBox1.Text =string.IsNullOrEmpty(url.Trim()) ? "http://127.0.0.1:5001/AutoWiring/UploadConfig" : url.Trim();
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string url = textBox1.Text.Trim();
           if( string.IsNullOrEmpty(url.Trim()))
            {
                MessageBox.Show("地址为空不能保存");
            }
            else
            {
                if (comMethod.SaveAPIPath(url))
                {
                    MessageBox.Show("保存成功");
                }
                else
                {
                    MessageBox.Show("保存失败");
                }

                    
            }
        }
    }
}
